﻿Imports System.Transactions
Imports Sistema_InformacionNaviera.BE
Imports Sistema_InformacionNaviera.DALC


Public Class TarifaFleteBC

    Public Function InsertarTarifaFlete(ByVal objTarifaFleteBE As TarifaFleteBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope

        Using objScope
            Try
                Dim objTarifaFleteDALC As TarifaFleteDALC = Nothing
                objTarifaFleteDALC = New TarifaFleteDALC

                objTarifaFleteDALC.InsertarTarifaFlete(objTarifaFleteBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function ModificarTarifaFlete(ByVal objTarifaFleteBE As TarifaFleteBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope

        Using objScope
            Try
                Dim objTarifaFleteDALC As TarifaFleteDALC = Nothing
                objTarifaFleteDALC = New TarifaFleteDALC

                objTarifaFleteDALC.ModificarTarifaFlete(objTarifaFleteBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function ListarTarifaFlete(ByVal objTarifaFleteBE As TarifaFleteBE) As List(Of TarifaFleteBE)
        Dim objListaTarifaList As List(Of TarifaFleteBE) = Nothing
        Dim objTarifaFleteDALC As TarifaFleteDALC = Nothing

        objTarifaFleteDALC = New TarifaFleteDALC
        objListaTarifaList = New List(Of TarifaFleteBE)()
        objListaTarifaList = objTarifaFleteDALC.ConsultarTarifaFlete(objTarifaFleteBE)

        Return objListaTarifaList
    End Function

    Public Function ValidarTarifaFlete(ByVal objTarifaFleteBE As TarifaFleteBE, ByRef bExito As Boolean, ByRef sMensaje As String, ByRef dt As DataTable) As List(Of TarifaFleteBE)
        Dim objListaTarifaList As List(Of TarifaFleteBE) = Nothing
        Dim objTarifaFleteDALC As TarifaFleteDALC = Nothing

        objTarifaFleteDALC = New TarifaFleteDALC
        objListaTarifaList = New List(Of TarifaFleteBE)()
        objListaTarifaList = objTarifaFleteDALC.ValidarExisteTarifaFlete(objTarifaFleteBE, bExito, sMensaje, dt)

        Return objListaTarifaList
    End Function

    Public Function ObtieneTarifaFlete(ByVal objTarifaFleteBE As TarifaFleteBE, ByRef bExito As Boolean, ByRef sMensaje As String, ByRef dt As DataTable) As List(Of TarifaFleteBE)
        Dim objListaTarifaList As List(Of TarifaFleteBE) = Nothing
        Dim objTarifaFleteDALC As TarifaFleteDALC = Nothing

        objTarifaFleteDALC = New TarifaFleteDALC
        objListaTarifaList = New List(Of TarifaFleteBE)()
        objListaTarifaList = objTarifaFleteDALC.ObtieneTarifaFlete(objTarifaFleteBE, bExito, sMensaje, dt)

        Return objListaTarifaList
    End Function

    Public Function EliminarTarifaFlete(ByVal objTarifaFleteBE As TarifaFleteBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objTarifaFleteDALC As TarifaFleteDALC = Nothing
                objTarifaFleteDALC = New TarifaFleteDALC

                objTarifaFleteDALC.EliminarTarifaFlete(objTarifaFleteBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

End Class
